package cuong.ptit.androidvn;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import cuong.ptit.andoridvn.R;
import cuong.ptit.androidvn.viewcontent.ViewPost;

/*
 * @author LeCuong 
 * @version 1.0
 */

public class MainActivity extends Activity implements OnClickListener {
	private Button bt_getUser, bt_getThread, bt_getThreadUser, bt_getPostUser,
			bt_getThreadStart, bt_web;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_activity);

		bt_getThread = (Button) findViewById(R.id.bt_list_thread);
		bt_getThread.setOnClickListener(this);

		bt_getUser = (Button) findViewById(R.id.bt_getUser);
		bt_getUser.setOnClickListener(this);

		bt_getThreadUser = (Button) findViewById(R.id.bt_getThreadUser);
		bt_getThreadUser.setOnClickListener(this);

		bt_getPostUser = (Button) findViewById(R.id.bt_getPostUser);
		bt_getPostUser.setOnClickListener(this);

		bt_getThreadStart = (Button) findViewById(R.id.bt_getThreadStart);
		bt_getThreadStart.setOnClickListener(this);

		bt_web = (Button) findViewById(R.id.bt_web);
		bt_web.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (v == bt_getUser) {

			Intent i = new Intent(MainActivity.this, GetUser.class);
			i.putExtra("user_name", "greenforest");
			i.putExtra("user_hash",
					"4adac471b51a35dc2c7fcd4229a6370856fca49a831e92858476af93f4636711");
			startActivity(i);

		} else if (v == bt_getThread) {
			startActivity(new Intent(getBaseContext(), ListCategory.class));

		} else if (v == bt_getThreadUser) {

			Intent i = new Intent(MainActivity.this, GetThreadStart.class);
			i.putExtra("user_idname", "10029");
			i.putExtra("user_name", "greenforest");
			i.putExtra("user_hash",
					"4adac471b51a35dc2c7fcd4229a6370856fca49a831e92858476af93f4636711");
			startActivity(i);

		} else if (v == bt_getPostUser) {

			Intent i = new Intent(MainActivity.this, GetPostUser.class);
			i.putExtra("user_idname", "10029");
			i.putExtra("user_name", "greenforest");
			i.putExtra("user_hash",
					"4adac471b51a35dc2c7fcd4229a6370856fca49a831e92858476af93f4636711");
			startActivity(i);
		} else if (v == bt_getThreadStart) {

			Intent i = new Intent(MainActivity.this, GetThreadJoin.class);
			i.putExtra("user_idname", "10029");
			i.putExtra("user_name", "greenforest");
			i.putExtra("user_hash",
					"4adac471b51a35dc2c7fcd4229a6370856fca49a831e92858476af93f4636711");
			startActivity(i);
		} else if (v == bt_web) {

			Intent i = new Intent(MainActivity.this, ViewPost.class);
			
			startActivity(i);
		}

	}

}
